// pages/mine/manager_login/manager_login.js
var app = getApp()
Page({

  /**
   * 页面的初始数据
   */
  data: {
    btnBinding: false,
    bindText: "登陆",
    account: "",
    password: "",
    formId: ""
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
  
  },
  btnBind: function (e) {
    console.log(e.detail.formId)
    var that = this
    // 设置按钮加载状态
    this.setData({
      btnBinding: true,
      bindText: "正在登陆",
      formId: e.detail.formId
    })

    var account = that.data.account
    var password = that.data.password
    if(account=='叶'&&password=='nannan851112'){
      app.globalData.managerLogin = true
      //刷新上一页数据
      var pages = getCurrentPages();
      if (pages.length > 1) {
        //上一个页面实例对象
        var prePage = pages[pages.length - 2];
        prePage.getTokenAndData()
      }
      wx.navigateBack({
        delta: 1
      })
    }else{
      wx.showToast({
        title: '登陆失败',
        image: '/image/error.png'
      })
    }
    this.setData({
      btnBinding: false,
      bindText: "登陆"
    })
  },
  accountInput: function (e) {
    this.setData({
      account: e.detail.value
    })
  },
  passwordInput: function (e) {
    this.setData({
      password: e.detail.value
    })
  }
})